package org.jeecg.modules.online.low.service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.online.low.entity.LowAppMenu;
import org.jeecg.modules.online.low.vo.LowAppMenuVo;

import java.util.List;

/**
 * @Description: low_app_menu
 * @Author: jeecg-boot
 * @Date: 2021-07-13
 * @Version: V1.0
 */
public interface ILowAppMenuService extends IService<LowAppMenu> {

    /**
     * 根据appId查询菜单，包括子级菜单
     *
     * @param appId
     * @return
     */
    List<LowAppMenuVo> listAndChildren(String appId);

    /**
     * 计算某个菜单的orderNum
     *
     * @param appId
     * @param parentId
     * @return
     */
    int calcOrderNum(String appId, String parentId);

    /**
     * 保存菜单，自动排序
     *
     * @param menu
     * @return
     */
    boolean saveMenu(LowAppMenu menu);

    /**
     * 移动菜单到分组（parenId置空即可移出分组）
     *
     * @param menu
     * @return
     */
    boolean moveToGroup(LowAppMenu menu);

    /**
     * 向上排序
     *
     * @param menu
     * @return
     */
    boolean orderToUp(LowAppMenu menu);

    /**
     * 向下排序
     *
     * @param menu
     * @return
     */
    boolean orderToDown(LowAppMenu menu);

    /**
     * 查询被逻辑删除的用户
     */
    List<LowAppMenu> queryLogicDeleted();

    /**
     * 查询被逻辑删除的菜单（可拼装查询条件）
     */
    List<LowAppMenu> queryLogicDeleted(LambdaQueryWrapper<LowAppMenu> wrapper);

    /**
     * 还原被逻辑删除的菜单
     */
    boolean revertLogicDeleted(List<String> idList, LowAppMenu updateEntity);

    /**
     * 彻底删除被逻辑删除的菜单
     */
    boolean removeLogicDeleted(List<String> idList);

    /**
     * 彻底删除菜单
     */
    boolean forceRemove(LambdaQueryWrapper<LowAppMenu> wrapper);

    /**
     * 批量删除表单设计器菜单
     *
     * @param idList 表单设计器ID列表
     * @return
     */
    boolean forceRemoveByDesformId(List<String> idList);

}
